﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AgileFx.MVC.PerformanceTools
{
    public class LogEntry
    {
        public const string RootEvent = "A41724E5-CB00-4475-9565-2C374BBAA843";

        public string Id { get; private set; }
        public string EventId { get; private set; }
        public string Type { get; private set; }
        public string Date { get; private set; }
        public string Time { get; private set; }
        public long Ticks { get; private set; }
        public string Data { get; private set; }
        public string ParentId { get; private set; }

        public LogEntry(string eventId, string type, string data)
            : this(eventId, type, data, RootEvent)
        {
        }

        public LogEntry(string eventId, string type, string data, string parentId)
        {
            Id = Guid.NewGuid().ToString();
   
            var now = DateTime.Now;
            Date = now.ToLongDateString();
            Time = now.ToString("HH:mm:ss.fff");
            Ticks = now.Ticks;

            this.EventId = eventId;
            this.Type = type;
            this.Data = data;
            this.ParentId = parentId;
        }
    }
}
